package com.cskaoyan.controller;

import com.cskaoyan.bean.BO.CommentDeleteBO;
import com.cskaoyan.bean.BO.GoodsDeleteBO;
import com.cskaoyan.bean.PO.MarketComment;
import com.cskaoyan.bean.PO.MarketGoods;
import com.cskaoyan.bean.VO.MarketCommentVo;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.AdminCommentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author linhanxin
 * @date 2022/8/15.
 */
@RestController
@RequestMapping("admin/comment")
public class AdminCommentController {
    @Autowired
    AdminCommentService adminCommentService;

    @RequiresPermissions("admin:comment:list")
    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo info,Integer userId,Integer valueId){
        CommonData<MarketCommentVo> data = adminCommentService.queryAll(info,userId,valueId);
        return BaseRespVo.ok(data);
    }

    @RequiresPermissions("admin:comment:delete")
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody CommentDeleteBO commentDeleteBO){
        adminCommentService.delete(commentDeleteBO.getId());
        return BaseRespVo.ok("成功");
    }
}
